<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="LProjectProgress" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="LProjectProgress" type="EIA.PM.Model.LProjectProgress, EIA.PM.Model" />
</alias>

<resultMaps>
<resultMap id="select-lprojectprogress-result" class="LProjectProgress">
<constructor>
    <argument argumentName="prg_id" column="prg_id"/>
    <argument argumentName="prj_id" column="prj_id"/>
    <argument argumentName="progress" column="progress"/>
    <argument argumentName="prg_date" column="prg_date"/>
    <argument argumentName="prg_des" column="prg_des"/>
    <argument argumentName="prg_state" column="prg_state"/>
    <argument argumentName="_date" column="_date"/>
    <argument argumentName="_staff" column="_staff"/>
</constructor>
<!--
    <result property="PrgId" column="prg_id"/>
    <result property="PrjId" column="prj_id"/>
    <result property="Progress" column="progress"/>
    <result property="PrgDate" column="prg_date"/>
    <result property="PrgDes" column="prg_des"/>
    <result property="PrgState" column="prg_state"/>
    <result property="Date" column="_date"/>
    <result property="Staff" column="_staff"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_LProjectProgress_where_pk">
WHERE prg_id=#PrgId#
</sql>

<sql id="sql_LProjectProgress_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="PrgId" prepend="AND">prg_id=#PrgId#</isPropertyAvailable>
    <isPropertyAvailable property="PrjId" prepend="AND">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="Progress" prepend="AND">progress=#Progress#</isPropertyAvailable>
    <isPropertyAvailable property="PrgDate" prepend="AND">prg_date=#PrgDate#</isPropertyAvailable>
    <isPropertyAvailable property="PrgDes" prepend="AND">prg_des LIKE concat('%', #PrgDes#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="PrgState" prepend="AND">prg_state=#PrgState#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend="AND">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend="AND">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_LProjectProgress_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="Progress" prepend=",">progress=#Progress#</isPropertyAvailable>
    <isPropertyAvailable property="PrgDate" prepend=",">prg_date=#PrgDate#</isPropertyAvailable>
    <isPropertyAvailable property="PrgDes" prepend=",">prg_des=#PrgDes#</isPropertyAvailable>
    <isPropertyAvailable property="PrgState" prepend=",">prg_state=#PrgState#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectLProjectProgress" parameterClass="" resultMap="LProjectProgress.select-lprojectprogress-result">
SELECT *
FROM l_project_progress
<include refid="sql_LProjectProgress_where_pk"/><!--where-->
</select>

<select id="SelectLProjectProgress_CV" parameterClass="System.Collections.IDictionary" resultMap="LProjectProgress.select-lprojectprogress-result">
SELECT *
FROM l_project_progress
<include refid="sql_LProjectProgress_where_cv"/><!--where-->
</select>

<insert id="InsertLProjectProgress" parameterClass="LProjectProgress">
<!--pre selectKey place-->
INSERT INTO l_project_progress(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id</isPropertyAvailable>
    <isPropertyAvailable property="Progress" prepend=",">progress</isPropertyAvailable>
    <isPropertyAvailable property="PrgDate" prepend=",">prg_date</isPropertyAvailable>
    <isPropertyAvailable property="PrgDes" prepend=",">prg_des</isPropertyAvailable>
    <isPropertyAvailable property="PrgState" prepend=",">prg_state</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="Progress" prepend=",">#Progress#</isPropertyAvailable>
    <isPropertyAvailable property="PrgDate" prepend=",">#PrgDate#</isPropertyAvailable>
    <isPropertyAvailable property="PrgDes" prepend=",">#PrgDes#</isPropertyAvailable>
    <isPropertyAvailable property="PrgState" prepend=",">#PrgState#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">#Staff#</isPropertyAvailable>
</dynamic>
)
<selectKey resultClass="int" type="post" property="PrgId" >
SELECT LAST_INSERT_ID()
</selectKey>
</insert>

<update id="UpdateLProjectProgress" parameterClass="System.Collections.IDictionary">
UPDATE l_project_progress
<include refid="sql_LProjectProgress_set_cols"/><!--set-->
<include refid="sql_LProjectProgress_where_pk"/><!--where-->
</update>

<delete id="DeleteLProjectProgress" parameterClass="">
DELETE FROM l_project_progress
<include refid="sql_LProjectProgress_where_pk"/><!--where-->
</delete>

<statement id="DeleteLProjectProgress_CV" parameterClass="LProjectProgress">
DELETE FROM l_project_progress
<include refid="sql_LProjectProgress_where_cv"/><!--where-->
</statement>

<delete id="ClearLProjectProgress">
DELETE FROM l_project_progress
</delete>
</statements>
</sqlMap>